home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / VISCAFE.BIN / MatrixEnumeration.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-06-19  |  2.0 KB  |  108 lines

  1. package symantec.itools.awt;
  2.  
  3. import java.util.Enumeration;
  4.  
  5. public final class MatrixEnumeration implements Enumeration {
  6.    // $FF: renamed from: m symantec.itools.awt.Matrix
  7.    private Matrix field_0;
  8.    private boolean started;
  9.  
  10.    public MatrixEnumeration(Matrix var1) {
  11.       this.field_0 = var1;
  12.       this.started = false;
  13.    }
  14.  
  15.    public boolean hasMoreElements() {
  16.       if (this.field_0 == null) {
  17.          return false;
  18.       } else if (!this.started && this.field_0.o != null) {
  19.          return true;
  20.       } else {
  21.          return this.field_0.nextElt != null ? true : this.hasMoreRows();
  22.       }
  23.    }
  24.  
  25.    public boolean hasMoreRows() {
  26.       if (this.field_0.nextRow == null) {
  27.          return false;
  28.       } else {
  29.          Matrix var1 = this.field_0.nextRow;
  30.  
  31.          while(var1.o == null && var1.nextElt == null) {
  32.             if ((var1 = var1.nextRow) == null) {
  33.                return false;
  34.             }
  35.          }
  36.  
  37.          return true;
  38.       }
  39.    }
  40.  
  41.    public Object nextElement() {
  42.       if (!this.started) {
  43.          this.started = true;
  44.          if (this.field_0.o != null) {
  45.             return this.field_0.o;
  46.          }
  47.       }
  48.  
  49.       if (this.field_0 == null) {
  50.          return null;
  51.       } else if (this.field_0.nextElt != null) {
  52.          this.field_0 = this.field_0.nextElt;
  53.          return this.field_0.o;
  54.       } else {
  55.          return (this.field_0 = this.findNextRow()) == null ? null : this.field_0.o;
  56.       }
  57.    }
  58.  
  59.    public int currRow() {
  60.       return this.field_0.row;
  61.    }
  62.  
  63.    public int currCol() {
  64.       return this.field_0.col;
  65.    }
  66.  
  67.    public Object nextRow() {
  68.       this.field_0 = this.findNextRow();
  69.       return this.field_0.o;
  70.    }
  71.  
  72.    public Object advanceTo(int var1) throws IllegalArgumentException {
  73.       this.started = true;
  74.       if (var1 >= this.field_0.row && var1 != this.field_0.row) {
  75.          Matrix var2 = this.field_0;
  76.  
  77.          while(this.field_0.row < var1) {
  78.             this.field_0 = this.findNextRow();
  79.             if (this.field_0 == null) {
  80.                this.field_0 = var2;
  81.                throw new IllegalArgumentException("requested row too large: r=" + var1);
  82.             }
  83.          }
  84.  
  85.          return this.field_0.o;
  86.       } else {
  87.          throw new IllegalArgumentException("r must be greater than current row: r=" + var1 + "current row=" + this.field_0.row);
  88.       }
  89.    }
  90.  
  91.    private Matrix findNextRow() {
  92.       this.started = true;
  93.       Matrix var1 = this.field_0.nextRow;
  94.       if (var1 == null) {
  95.          return null;
  96.       } else {
  97.          while(var1.o == null && var1.nextElt == null) {
  98.             if ((var1 = var1.nextRow) == null) {
  99.                return null;
  100.             }
  101.          }
  102.  
  103.          var1 = var1.o != null ? var1 : var1.nextElt;
  104.          return var1;
  105.       }
  106.    }
  107. }
  108.